﻿<Window x:Class="BFsharp.Formula.Samples.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Samples="clr-namespace:BFsharp.Formula.Samples"
    Title="MainWindow" Height="600" Width="500">
    <Window.Resources>
        
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Margin" Value="5"/>
        </Style>
        
        <Style TargetType="{x:Type Button}">
            <Setter Property="Margin" Value="5"/>
        </Style>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Margin" Value="5"/>
        </Style>

        <Style TargetType="{x:Type CheckBox}">
            <Setter Property="Margin" Value="2"/>
        </Style>
        
        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="Margin" Value="2"/>
        </Style>
        
        <Style TargetType="{x:Type GridSplitter}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Height" Value="5"/>
        </Style>
        <Samples:BoolToOppositeBoolConverter x:Key="oppositeConverter" />
    </Window.Resources>
    <DockPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="60"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="100"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
                <TextBlock>Sample:</TextBlock>
                <ComboBox Width="150" x:Name="Samples" ItemsSource="{Binding}" 
                          DisplayMemberPath="Name" SelectedIndex="0" />
            </StackPanel>
            <TextBox Grid.Row="1" x:Name="Formula" AcceptsReturn="True" 
                     HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
                     Text="{Binding SelectedValue.Formula, ElementName=Samples}" />

            <GridSplitter Grid.Row="2" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch" />
            <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Content="Compile" Click="Button_Click"/>
            </StackPanel>
            
            <TextBlock Grid.Row="4">Status:</TextBlock>
            <TextBox Grid.Row="5" IsReadOnly="True" x:Name="Status" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Height="Auto" />
            
            <GridSplitter Grid.Row="6" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch"/>
            <StackPanel Grid.Row="7">
                
                <Button Click="Button_Click_1" Width="Auto">Execute</Button>
                <StackPanel Orientation="Horizontal">
                    <TextBlock>Results:</TextBlock>
                    <TextBox IsReadOnly="true" Width="150" x:Name="Results" />
                </StackPanel> 
            </StackPanel>
            
            <GroupBox Grid.Row="8" Header="Providers">
                <StackPanel>
                    <CheckBox x:Name="Math" IsChecked="{Binding SelectedValue.Math, Mode=OneWay, ElementName=Samples}">Math</CheckBox>
                    <CheckBox x:Name="Date" IsChecked="{Binding SelectedValue.Date, Mode=OneWay, ElementName=Samples}">Date</CheckBox>
                    <CheckBox x:Name="All" IsChecked="{Binding SelectedValue.All, Mode=OneWay, ElementName=Samples}">All</CheckBox>
                    <TextBlock>Using:</TextBlock>
                    <TextBox x:Name="Using" Height="60" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Text="{Binding SelectedValue.Using, Mode=OneWay, ElementName=Samples}" />
                    <CheckBox x:Name="SampleEntity" IsChecked="{Binding SelectedValue.SampleEntity, Mode=OneWay, ElementName=Samples}">SampleEntity</CheckBox>
                    <CheckBox x:Name="Custom" IsChecked="{Binding SelectedValue.Custom, Mode=OneWay, ElementName=Samples}">Custom</CheckBox>
                </StackPanel>
            </GroupBox>
        </Grid>
    </DockPanel>
</Window>
